package com.endava.FlowControlAndAssertions;

/*2. Creating a Labeled while Loop 
 * Try creating a labeled while loop.
 *  Make the label outer and provide a condition to check whether a variable age is less than or equal to 21. 
 *  Within the loop, increment age by one. 
 *  Every time the program goes through the loop, check whether age is 16.
 *  If it is, print the message "get your driver's license" and continue to the outer loop. 
 *  If not, print "Another year."
 - The outer label should appear just before the while loop begins.
 - Make sure age is declared outside of the while loop.
 */

public class Ex2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int age = 15;
		OuterSign: while (age <= 21) {
			age++;
			if (age == 16) {
				System.out.println("Get your driver's license");
				continue OuterSign;
			} else {
				System.out.println("Another year");
			}
		}
		System.out.println("I am a major person in all the states");
	}

}
